Repository navigation
Report the reference images of the num_ref_images window that hold no results - #148
Merged
Merged
Conversation
… results The reference images named by ref_img_indices were checked for intensity values, the first num_ref_images ones were not. An image that could not be read keeps its ID in the image infos but produces no intensities, so a skipped image inside the reference window dropped out of the average unnoticed. With num_ref_images = 1 and no results for image 1 the reference intensities came back empty and the analysis normalised by nothing. Both paths now request an explicit list of image IDs and hand it to _check_requested_ref_imgs_available, which keeps the behaviour the named reference images already had: a partially missing window warns and is averaged over the remaining images, an empty one raises. The raised message names num_ref_images and ref_img_indices as the settings to change. The reference window is not slid to the next available images on purpose. The window has to precede the experiment, so moving it would pull an image that may already show smoke into the reference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
calc_and_set_ref_intensitieshas two ways of picking the reference images, and only one of them was checked. The images named byref_img_indicesgo through_check_requested_ref_imgs_available, which reports the ones that hold no intensity values. The firstnum_ref_imagesones, selected withimg_id <= num_ref_imgs, went through nothing.An image that could not be read keeps its ID in the image infos but produces no intensities, so a skipped image inside the reference window dropped out of the average unnoticed:
num_ref_images = 1and no results for image 1: the reference intensities came back empty. The run printedImages with indices [] were used for calculating reference intensitiesand carried on normalising by nothing.num_ref_images = 3and no results for image 1: averaged over 2 images instead of 3, silently, where the same loss among named reference images would have warned.The first case is the one left open by #143, which only got the column names past the missing image 1. Its acceptance test had to set
num_ref_images = 2to get a usable reference at all.Change
Both paths now build an explicit list of requested image IDs —
ref_img_indices, orrange(1, num_ref_imgs + 1)— and hand it to_check_requested_ref_imgs_available, which takes the IDs as an argument instead of readingref_img_indicesitself. The behaviour the named reference images already had now covers the window as well: a partially missing window warns and is averaged over the remaining images, a window without any data raises. The raised message gained the settings to change, since the empty reference was the confusing part of the report.The window is deliberately not slid to the next available images. The reference window has to precede the experiment, so moving it would pull an image that may already show smoke into the reference. Averaging over fewer clean images is safe; silently picking a later one is not.
Execute Ledsa Expecting FailureandExecute Ledsa Expecting Warningare new acceptance keywords.Execute Ledsahands its output tocheck_error_msg, which aborts the whole suite as soon as anything reaches stderr, so neither a reported error nor a warning could be asserted through it.Verification
ledsa/tests/UnitTests/test_reference_intensities.py: a complete window averaged without a warning, the reported single-image case, an unreadable first image of a larger window, a window reaching past the analysed images, and the settings named in the raised message.make_solvergainednum_ref_imgsand defaultsref_img_indicestoNone.07_test_corrupted_images.robotthat truncatestest_img_1.jpg, runs-s3_fastand--analysiswith the default configuration, and asserts the run stops naming the missing reference image.Analysis Reads The Column Names From The First Existing Result Filefrom Read the column names from the first existing step 3 result file #143 now asserts the warning instead of running into it. Itsnum_ref_images = 2window still names image 1, and the first full run of the suite aborted on exactly that warning before the keyword existed.config_stacked.iniof the acceptance tests setsnum_ref_images = 1, noexcept ValueErrorswallows the raise, and the averaged path keeps its head rows under their original IDs.Not covered:
average_all_fitpartakes the reference head positionally (iloc[:num_ref_imgs]) while the solver selects by ID, and it renumbers the averaged tail fromnum_ref_imgs + 1. With a skipped image those two numbering schemes look like they can collide on animg_id. Not reproduced here, so it needs a test of its own.🤖 Generated with Claude Code